﻿
@using SelfManagement.Web.Models.ViewModels.ArticleModels;
@model CategoryViewModel

@{
    bool isEdit = Model.IsEdit;
    string title = isEdit ? "编辑" : "新建";
}

@section Styles{
    @*@Styles.Render(BundleConfig.TasksCssBundle)*@
}

@section Scripts{
    <script src="~/assets/plugins/jquery.tmpl.js"></script>
    <script type="text/javascript">

        $(function () {
            window.beforeAjaxFormSubmit = function () {
                return true;
            }
        });

    </script>
}

<!-- BEGIN FORM PORTLET -->
<div class="portlet">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-reorder"></i>@(title)文章分类
        </div>
    </div>
    <div class="portlet-body form">

        @using (Html.BeginForm("CreateOrEditCategory", "Article", FormMethod.Post, new { @class = "form-horizontal js-ajax-form" }))
        {
            @Html.AntiForgeryToken()
            @Html.HiddenFor(m => m.Id)
            @Html.HiddenFor(m => m.IsEdit)
            <div class="form-body">

                <div class="form-group">
                    @Html.LabelFor(m => m.CategoryName, new { @class = "col-md-2 control-label" })
                    <div class="col-md-9">
                        @Html.TextBoxFor(m => m.CategoryName, new { @class = "form-control", @placeholder = "文章分类" })
                        @Html.ValidationMessageFor(m => m.CategoryName)
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-md-offset-2 col-md-9">
                        @Html.ValidationSummary()
                    </div>
                </div>
            </div>
            <div class="form-actions fluid">
                <div class="col-md-offset-3 col-md-9">
                    <button type="submit" class="btn btn-success">保存</button>
                    <a href="@HttpContext.Current.Request.UrlReferrer" class="btn btn-default">取消</a>
                </div>
            </div>
        }
    </div>
</div>